package com.ali.thread;

public class ClassLoadingDeadlock {

	public static void main(String[] arg) {

		// Bar bu = new Bar();
		new Thread("");
		new Thread(new FooUser(), "FooUser").start();

		new Thread(new BarUser(), "BarUser").start();

	}

}

class FooUser implements Runnable {
	public void run() {
		System.out.println("FooUser causing class Foo to be loaded");
		Foo f = new Foo();
		System.out.println("FooUser done");
	}
}

class BarUser implements Runnable {
	public void run() {
		System.out.println("BarUser causing class Bar to be loaded");
		Bar b = new Bar();
		System.out.println("BarUser done");
	}
}

class Foo {
	static Bar b = new Bar();
}

class Bar {
	static Foo f = new Foo();
}
